<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/WEB-INF/tld/ce.tld" prefix="ce" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/cases/source/";  //应用的地址名
String modifyActionName = path+request.getAttribute("REQUEST_PATH")+"?op=savejs";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>备选案源台账</title>
    <script language="javascript" src="<%=path %>/jslib/orgSelect.js"></script>
<script type="text/javascript">
<!--
           $(function(){
               $('#caseNumber').validatebox({
                   required:'true',
                   missingMessage:'请输入案源编号',
                   validType:'length[1,20]'
               });
               $('#taxpayerNumber').validatebox({
                   required:'true',
                   missingMessage:'请输入纳税人识别号',
                   validType:'length[1,20]'
               });
               
               $('#caseFromNum').validatebox({
                   required:'true',
                   missingMessage:'请选择案件来源',
                   validType:'length[1,20]'
               });
               
               $('#illegalTypeNum').validatebox({
                   required:'true',
                   missingMessage:'请选择涉嫌违法类型',
                   validType:'length[1,20]'
               });
               
               
               $('#inspectionDeptId').combobox({
            		url:'<%=path %>/util/util_getInspectionList.action?id=15009070000',
            		valueField:'id',
            		textField:'text',
            		editable:false,
            		onChange: function(n,o){
            			var url = '<%=path %>/util/util_getInspectionList.action?id='+n;
            			$('#collectionDeptId').combobox('reload', url);
            		}
            	});
               
               $('#collectionDeptId').combobox({
             		url:'<%=path %>/util/util_getInspectionList.action?id='+$('#inspectionDeptId').val(),
             		valueField:'id',
             		textField:'text',
             		editable:false
             	});
               if($('#inspectionDeptId').val()){
            	   $('#inspectionDeptId').combobox('setValue',$('#inspectionDeptId').val());
            	   $('#inspectionDeptId').change();
               }
               if($('#collectionDeptId').val()){
            	   $('#collectionDeptId').combobox('setValue',$('#collectionDeptId').val());
               }
               
               $('#taxpayerNumber').change(function(){
					if($('#taxpayerNumber').val()){
						$.post("<%=path%>/cases/source/CaseSource_getNsrinfoByTaxpayerNumber.action?taxpayerNumber="+$('#taxpayerNumber').val(),function(data)
								{
							 		jsonReStr = jQuery.parseJSON(data);
							 		if(jsonReStr.opState=="failure"){  //操作失败处理
							 			$('#inspectionDeptId').combobox('setValue','');
							 			$('#collectionDeptId').combobox('setValue','');
							 			$('#involvedEnterprice').val('');
							 			$('#inspectionDept').val('');
							 			$('#collectionDept').val('');
						                $.messager.alert('消息提示','操作处理失败！原因如下：<br><font color=red>'+jsonReStr.opInfo+'</font>','error');
						               // $('#taxpayerNumber').val('');
							 			//return ;
						            }else{
						            	$('#inspectionDeptId').combobox('setValue',jsonReStr.jcjdm);
						            	$('#inspectionDept').val(jsonReStr.jcjmc);
						            	
						            	$('#involvedEnterprice').val(jsonReStr.nsrmc);
						            	$('#caseNumber').val(jsonReStr.statusInfo);
						            	//$('#inspectionDeptId').change();
						            	$('#collectionDeptId').combobox('setValue',jsonReStr.zgswjDm);
						            	$('#collectionDept').val(jsonReStr.zgswjMc);
						            }
							 		
							 	}
							 	);	
					}
					
              	});
	           //点击添加按钮操作
			   $('#addBtn').click(function(){
				  $('#caseFromName').val($('#caseFromNum option:selected').text());
				  $('#illegalTypeName').val($('#illegalTypeNum option:selected').text());
                  $('#editForm').submit();
	            });
	            //表单验证及提交处理操作
	           $('#editForm').form({
			        url:'<%=modifyActionName%>',
			        onSubmit: function(){
			           if($(this).form('validate')){
			                 $.util.showLoading();
			                 $('#operateWindow').window('close');
                            return true;
			             }else{
			                return false;
			             }
			        },
			        success:function(data){
			            $.util.removeLoading();
                        returnOptMsg(data);
			        }
				});
	            
           });
//-->
</script>
  </head>
  
  <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
    <s:form action="editForm" method="post">
    <s:hidden name="po.vcId"/>
    <s:hidden id="caseFromName" name="po.caseFromName"/>
    <s:hidden id="illegalTypeName" name="po.illegalTypeName"/>
    <s:hidden id="inspectionDept" name="po.inspectionDept"/>
    <s:hidden id="collectionDept" name="po.collectionDept"/>
	<table align="center" class="tb_add_th" width="100%">
		<tr><th>纳税人识别号:</th><td><s:textfield id="taxpayerNumber"  name="po.taxpayerNumber" /></td>
		    <th>涉案企业:</th><td><s:textfield id="involvedEnterprice"  name="po.involvedEnterprice" /></td>
		</tr>
		<tr><th>案 源 编 号:</th><td><s:textfield id="caseNumber"  name="po.caseNumber" /></td>
		    <th>接收日期:</th><td><input type="text" id="receiveDate"  name="po.receiveDate" value="<s:date name="po.receiveDate" format="yyyy-MM-dd"/>" class="Wdate" onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" readonly="true"/></td>
		</tr>
		
		<tr><th>管辖稽查局:</th><td><s:textfield id="inspectionDeptId"  name="po.inspectionDeptId" />
		</td>
		    <th>所属征管局:</th><td><s:textfield id="collectionDeptId"  name="po.collectionDeptId" /></td>
		</tr>
		<tr><th>是否重点税源:</th><td><s:radio name="po.isImportant" list="#{1:'是',0:'否'}"/></td>
		    <th>是否保密税源:</th><td><s:radio name="po.isSecret" list="#{1:'是',0:'否'}"/></td>
		</tr>
		<tr></tr>
		<tr><th>案件来源:</th><td><ce:dictSelect id="caseFromNum" name="po.caseFromNum" dictName="备选案源台账-案件来源" blankOption="true"/></td>
		    <th>涉嫌违法类型:</th><td><ce:dictSelect id="illegalTypeNum" name="po.illegalTypeNum" dictName="备选案源台账-涉嫌违法类型" blankOption="true"/></td>
		</tr>
		<tr><th style="text-align:center">基本情况:</th><td colspan="3"><s:textarea id="baseResult"  name="po.baseResult" rows="4" cols="50" style="width:425px;height:50px;"/></td></tr>
		<tr><th>登记人:</th><td><s:textfield id="registerPerson"  name="po.registerPerson" label="登记人" /></td>
		    <th>登记日期:</th><td><input type="text" id="registerDate"  name="po.registerDate" value="<s:date name="po.registerDate" format="yyyy-MM-dd"/>" class="Wdate" onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" readonly="true" /></td>
		</tr>
	</table>    
   </s:form>
  </body>
</html>

